<?php use_stylesheet('books.css') ?>
<h1>Livres en vente</h1>

 

<?php foreach ($pager->getResults() as $book): ?>
<div class="category">
  <div class="feed">
  	<a href="#" class="showBookCopies"> 
    <?php echo $book->countInventory() ?>&nbsp;exemplaires&nbsp;[+]
    </a>
  </div>
  <h1><a href="<?php echo url_for('book_show_user', $book) ?>"><?php echo $book ?></a></h1>
</div>
 
<?php include_partial('inventory/list', array('bookCopies' => $book->getActiveBooks(sfConfig::get('app_max_books_on_homepage')))) ?>

<?php endforeach; ?>

<?php if ($pager->haveToPaginate()): ?>
  <div class="pagination">
    <a href="<?php echo url_for('homepage') ?>?page=1">
      <img src="/images/first.png" alt="First page" />
    </a>
 
    <a href="<?php echo url_for('homepage') ?>?page=<?php echo $pager->getPreviousPage() ?>">
      <img src="/images/previous.png" alt="Previous page" title="Previous page" />
    </a>
 
    <?php foreach ($pager->getLinks() as $page): ?>
      <?php if ($page == $pager->getPage()): ?>
        <?php echo $page ?>
      <?php else: ?>
        <a href="<?php echo url_for('homepage') ?>?page=<?php echo $page ?>"><?php echo $page ?></a>
      <?php endif; ?>
    <?php endforeach; ?>
 
    <a href="<?php echo url_for('homepage') ?>?page=<?php echo $pager->getNextPage() ?>">
      <img src="/images/next.png" alt="Next page" title="Next page" />
    </a>
 
    <a href="<?php echo url_for('homepage') ?>?page=<?php echo $pager->getLastPage() ?>">
      <img src="/images/last.png" alt="Last page" title="Last page" />
    </a>
  </div>
<?php endif; ?>
 
<div class="pagination_desc">
  <strong><?php echo count($pager) ?></strong> livres avec inventaire
 
  <?php if ($pager->haveToPaginate()): ?>
    - page <strong><?php echo $pager->getPage() ?>/<?php echo $pager->getLastPage() ?></strong>
  <?php endif; ?>
</div>

  <a href="<?php echo url_for('inventory/new') ?>">New</a>
